/**
 * 
 */
package com.rpg.base.flyweight;

/**
 * @author Donald
 */
public abstract class InteractiveObjectItemData {
	/** the current number in possession. */
	private short					count;				// current number
	/** modifier data for the item. */
	protected EquipmentItemModifier[]	equipitem;
	private char					food_value;
	private short					LightValue;
	private short					maxcount;			// max number cumulable
	private short					playerstacksize;
	/** the item's price. */
	private int					price;
	/**
	 * Gets the item's price.
	 * @return {@link int}
	 */
	public final int getPrice() {
		return price;
	}
	/**
	 * Sets the item's price.
	 * @param val the price to set
	 */
	public final void setPrice(final int val) {
		this.price = val;
	}
	private char					stealvalue;
	/** Clears data for equipped items. */
	public final void clearEquipItemData() {
		for (int i = 0; i < equipitem.length; i++) {
			if (equipitem[i] != null) {
				equipitem[i].clearData();
			}
		}
	}
	/**
	 * Gets the list of equipment item modifiers.
	 * @return {@link EquipmentItemModifier}[]
	 */
	public final EquipmentItemModifier[] getEquipitem() {
		return equipitem;
	}
	/**
	 * Gets a specific element from the list of data.
	 * @param index the index
	 * @return {@link EquipmentItemModifier}
	 */
	public final EquipmentItemModifier getEquipItemModifier(final int index) {
		EquipmentItemModifier elem = null;
		if (equipitem != null
				&& index >= 0
				&& index < equipitem.length) {
			elem = equipitem[index];
		}
		return elem;
	}
	/** Initializes data for equipped items. */
	public abstract void initEquipitem();
	/**
	 * Sets the item's modifiers for a specific element.
	 * @param type the type
	 * @param flags any flags assigned to the modifier
	 * @param special the special value
	 * @param value the value of the modifier
	 */
	public final void setModifier(final int type, final long flags,
			final int special, final int value) {
		if (equipitem[type] == null) {
			equipitem[type] = new EquipmentItemModifier();
		} else {
			equipitem[type].clearData();
		}
		equipitem[type].setFlag(flags);
		equipitem[type].setSpecial(special);
		equipitem[type].setValue(value);
	}
}
